Deprecated Prizm Content Connect
convert2swfclient Constructor

Convert2SWFClient constructor allows you to use convert2swfclient.jar functionality within your own java application or JSP script.

Example:

 
Copy Code

package sandbox;

import java.io.File;

import com.adeptol.Convert2SWFClient;

public class MyClient {
  public void doFastPageCountRequest() {
    String args[] = new String[2];
    String source = "c:/temp/sample.doc";
    args[0] = "source=" + source;
    args[1] = "fastpgcnt";
    String pages = Convert2SWFClient.sendRequest(args, false);
    System.out.println("Fast page count of the file: " + source + " has reported: " + pages);
  }

  public void doTotalPageCountRequest() {
    String args[] = new String[2];
    String source = "c:/temp/sample.doc";
    args[0] = "source=" + source;
    args[1] = "totalpages";
    String pages = Convert2SWFClient.sendRequest(args, false);
    System.out.println("Precise page count of the file: " + source + " has reported: " + pages);
  }
 
  public void doConversionRequest() {
    String args[] = new String[2];
    String source = "c:/temp/sample.doc";
    String target = "c:/temp/sample.swf";
    args[0] = "source=" + source;
    args[1] = "target=" + target;
    // using false as 2nd parameter this call will suppress to output the result to System.out
    // and returns the conversion as string
    String result = Convert2SWFClient.sendRequest(args, false);
    File test = new File(target);
    if (test.exists() && test.length() > 0) {
      System.out.println("Success!");
      System.out.println("Source: " + source + " has been converted to: " + target + "\n");
    } else {
      System.out.println("An error has occurred!\n");
      System.out.println(result);
    }
  }

  public static void main(String[] args) {
    MyClient myClient = new MyClient();
    myClient.doFastPageCountRequest();
    myClient.doTotalPageCountRequest();
    myClient.doConversionRequest();
  }
}

 

 


©2014. Accusoft Corporation. All Rights Reserved.

Send Feedback